<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/6/20
 * Time: 15:06
 */
namespace  App\Models\Forms;

use App\Helper;
use App\Models\Group;
use App\Models\IReadable;
use Encore\Admin\Widgets\Form;

/**
 * Class TbSpiderConfig
 * @package App\Models\Forms
*/
class PddSpiderConfig extends Form implements IReadable
{

    public $title = "拼多多";


    public function attributeLabels()
    {
        return [
           'cid' => [
                'type' => 'select',
                'label' => '采集分类',
                'options' => PddDefiner::CATEGORIES,
                'required' => true
            ],
            'send_type' => [
                'type' => 'radio',
                'label' => '发送类型',
                'options' => TaobaoDefiner::SEND_TYPE,
                'required' => true
            ],
            'with_coupon' => [
                'label' => '优惠券',
                'type' => 'radio',
                'options' => [
                    "false" => '无优惠券',
                    'true' => '有优惠券'
                ],
                'value' => 0,
                'visible' => true
            ],
           /* 'send_group' => [
                'label' => '发送群组',
                'type' => 'select',
                'options' => Group::getByUid(),
            ],*/
           /* 'yx' => [
                'label' => '营销活动',
                'type' => 'checkbox',
                'options' => TaobaoDefiner::YX,
                'required' => true
            ],*/
            'sort_type' => [
                'label' => '排序方式',
                'type' => 'select',
                'options' => PddDefiner::SORT_TYPE,
                'required' => true,
                'value' => 0
            ],
            /**
             * range_from	LONG	非必填	区间的开始值
            range_id	INTEGER	非必填	0，最小成团价 1，券后价 2，佣金比例 3，优惠券价格 4，广告创建时间 5，销量 6，佣金金额 7，店铺描述分 8，店铺物流分 9，店铺服务分 10， 店铺描述分击败同行业百分比 11， 店铺物流分击败同行业百分比 12，店铺服务分击败同行业百分比 13，商品分 17 ，优惠券/最小团购价 18，过去两小时pv 19，过去两小时销量
            range_to	LONG	非必填	区间的结束值
             *
             */
            'min_yj' => [
                'label' => '最低佣金',
                'type' => 'integer',
                'required' => true,
                'value' =>  0
            ],
            'min_sales' => [
                'label' => '最低销量',
                'type' => 'integer',
                'required' => true,
                'value' =>  0
            ],
            'max_coupon_price' => [
                'label' => '最高券后价',
                'type' => 'integer',
                'place_holder' => "券后价格不高于此数据",
                'required' => true,
                'value' => 0
            ],
            'page' => [
                'label' => '采集页数',
                'type' => 'integer',
                'place_holder' => "每页50条数据",
                'value' => 1
            ],
            'keyword' => [
                'type' => 'text',
                'label' => '关键词',
                'place_holder' => "请输入采集关键词，如 袜子"
            ]
        ];
    }

    public function form() {
        Helper::loadForm($this);
    }

    public function getAttribute($field)
    {
        // TODO: Implement getAttribute() method.
    }

}
